package test.com.sms.selenium.singlepoint.util;

import java.util.Set;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;


public class SpIncidentEditAssetsSelectPageUtil extends SeleniumPageUtil {

	public final static By IES_TD_STATUS_CODE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[1]");
	public final static By IES_CHECKBOX_ACTIVE = By.id("ctl44_chkActive");
	public final static By IES_LABEL_ACTIVE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[1]");
	public final static By IES_CHECKBOX_INACTIVE = By.id("ctl44_chkInactive");
	public final static By IES_LABEL_INACTIVE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[2]");
	public final static By IES_CHECKBOX_PENDING = By.id("ctl44_chkPending");
	public final static By IES_LABEL_PENDING = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[3]");
	public final static By IES_CHECKBOX_RETIRED = By.id("ctl44_chkRetired");
	public final static By IES_LABEL_RETIRED = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[4]");
	public final static By IES_CHECKBOX_OOS = By.id("ctl44_chkOutOfService");
	public final static By IES_LABEL_OOS = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[2]/label[5]");
	public final static By IES_TD_SEARCH_ID = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[3]/tbody/tr/td[1]");
	public final static By IES_REDIO_CUS = By.id("ctl44_rdoCustomer");
	public final static By IES_LABEL_CUS = By.id("ctl44_lblCustomerName");
	public final static By IES_REDIO_ALLCUS = By.id("ctl44_rdoAllCustomers");
	public final static By IES_LABEL_ALLCUS = By.id("ctl44_lblAllCustomers");
	public final static By IES_TD_AS_NAME = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[1]/td[1]");
	public final static By IES_INPUT_AS_NAME = By.id("ctl44_txtAssetName");
	public final static By IES_TD_AS_TYPE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[1]/td[3]");
	public final static By IES_SELECT_AS_TYPE = By.id("ctl44_cboAssetTypeID");
	public final static By IES_TD_SUB_TYPE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[1]/td[5]");
	public final static By IES_SELECT_SUB_TYPE = By.id("ctl44_cboAssetSubTypeID");
	public final static By IES_TD_SERIAL = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[2]/td[1]");
	public final static By IES_INPUT_SERIAL = By.id("ctl44_txtSerialNum");
	public final static By IES_TD_MFG = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[2]/td[3]");
	public final static By IES_SELECT_MFG = By.id("ctl44_cboMfgCodeID");
	public final static By IES_TD_MODEL = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[2]/td[5]");
	public final static By IES_SELECT_MODEL = By.id("ctl44_lstModelCodeID");
	public final static By IES_SPAN_AS_GROUP = By.id("ctl44_lblAssetGroupID");
	public final static By IES_SELECT_AS_GROUP = By.id("ctl44_cboAssetGroupID");
	public final static By IES_TD_ADD_NAME = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[4]/td[1]");
	public final static By IES_SELECT_ADD_NAME = By.id("ctl44_cboAddressID");
	public final static By IES_SPAN_LOCATION = By.id("ctl44_lblLocationID");
	public final static By IES_SELECT_LOCATION = By.id("ctl44_cboLocationID");
	public final static By IES_TD_OTHER_FIELD = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[5]/td/table/tbody/tr/td[1]");
	public final static By IES_SELECT_OTHER_FIELD = By.id("ctl44_OtherSearch1_cboOther");
	public final static By IES_SPAN_OTHER_VALUE = By.id("ctl44_OtherSearch1_lblOther");
	public final static By IES_INPUT_OTHER_VALUE = By.id("ctl44_OtherSearch1_txtOtherText");
	public final static By IES_CHECKBOX_OTHER_VALUE = By.id("ctl44_OtherSearch1_chkOther");
	public final static By IES_TD_USER_FORM = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[6]/td[1]");
	public final static By IES_SELECT_USER_FORM = By.id("ctl44_cboUdfID");
	public final static By IES_TD_FIELD = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[6]/td[3]");
	public final static By IES_SELECT_FIELD = By.id("ctl44_cboUdfFieldID");
	public final static By IES_TD_VALUE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr[6]/td[5]");
	public final static By IES_SELECT_VALUE = By.id("ctl44_cboAnswers");
	public final static By IES_BTN_SEARCH = By.id("ctl44_btnSearch");
	public final static By IES_BTN_CLEAR = By.id("ctl44_btnClear");
	public final static By IES_BTN_CLOSE = By.id("ctl44_btnClose");
	public final static By IES_LINK_FIRST_RECORD = By.xpath("//*[@id='tblResults']/tbody/tr[4]/td[1]/a");
	public final static By IES_TD_FIRST_RECORD_SERIAL = By.xpath("//*[@id='tblResults']/tbody/tr[4]/td[5]");
	public static void enterAssetSelect(){
		Set<String> before = SeleniumUtil.getWindowHandles();
		//click 'selece different asset' link to enter Asset search page
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpIncidentEditAssetsPageUtil.IEA_LINK_SDA));
		SeleniumUtil.switchToPromptedWindow(before, SeleniumUtil.getWindowHandles());
		waitForPageToLoad();	
	}
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.waitOnElements(new By[]{
				IES_BTN_SEARCH
		});
	}
}
